home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / gamesmaster / demosrc / agafloodfill.s < prev    next >
Text File  |  1996-07-16  |  5KB  |  181 lines

  1. ;AGA FloodFill Demo
  2. ;------------------
  3. ;A demo of how you should use the FLOOD raster command.
  4. ;
  5. ;To exit the demo, press the left mouse button.
  6.  
  7.     opt    o+
  8.  
  9.     INCLUDE    "exec/exec_lib.i"
  10.     INCLUDE    "games/games_lib.i"
  11.     INCLUDE    "games/games.i"
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17. LOCAL    =    0
  18.  
  19.     SECTION    "FadingDemo",CODE
  20.  
  21. ;===========================================================================;
  22. ;                             INITIALISE DEMO
  23. ;===========================================================================;
  24.  
  25. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  26.     move.l    ($4).w,a6
  27.     lea    GMS_Name(pc),a1
  28.     moveq    #$00,d0
  29.     CALL    OpenLibrary
  30.     move.l    d0,GMS_Base
  31.     beq.s    Quit
  32.  
  33.     move.l    GMS_Base(pc),a6
  34.     CALL    SetUserPri
  35.  
  36.     move.l    GMS_Base(pc),a6          ;Initialise our screen.
  37.     lea    ScreenStruct(pc),a0
  38.     CALL    Add_Screen
  39.     tst.l    d0
  40.     bne.s    Error
  41.  
  42.     move.l    SS_MemPtr1(a0),a1        ;Destination = SS_MemPtr1.
  43.     lea    PackedPicFile(pc),a0     ;File Name.
  44.     CALL    QuickLoad
  45.     tst.l    d0
  46.     beq.s    Error
  47.  
  48.     lea    ScreenStruct(pc),a0      ;Unpack the data on top of itself.
  49.     move.l    SS_MemPtr1(a0),a1
  50.     move.l    a1,a0
  51.     moveq    #$00,d0
  52.     CALL    SmartUnpack
  53.  
  54.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  55.     CALL    Show_Screen
  56.  
  57. ;===========================================================================;
  58. ;                                MAIN CODE
  59. ;===========================================================================;
  60.  
  61. .Flood    CALL    Wait_OSVBL
  62.     bsr.s    FloodFill
  63.     tst.w    d0
  64.     beq.s    .Flood
  65.  
  66.     CALL    Wait_LMB
  67.  
  68. .FadeOut
  69.     CALL    Wait_OSVBL
  70.     moveq    #2,d0                    ;d0 = Speed of fade.
  71.     CALL    B24_FadeToBlack          ;Do the fade routine.
  72.     tst.w    d0                       ;Has the fade finished yet?
  73.     bne.s    .FadeOut                 ;If not, keep doing it.
  74.  
  75. ;===========================================================================;
  76. ;                              RETURN TO DOS
  77. ;===========================================================================;
  78.  
  79.     CALL    Delete_Screen            ;Give back screen memory etc.
  80. Error    move.l    GMS_Base(pc),a1
  81.     move.l    ($4).w,a6
  82.     CALL    CloseLibrary
  83. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  84.     moveq    #$00,d0
  85.     rts
  86.  
  87. ;===========================================================================;
  88. ;                               FLOOD FILL
  89. ;===========================================================================;
  90.  
  91. FloodFill:
  92.     lea    RasterList(pc),a2
  93.     cmp.w    #256,2(a2)
  94.     bge.s    .done
  95.     addq.w    #1,2(a2)
  96.     CALL    Update_RasterList
  97.     moveq    #$00,d0
  98.     rts
  99.  
  100. .done    moveq    #-1,d0
  101.     rts
  102.  
  103. ;===========================================================================;
  104. ;                                  DATA
  105. ;===========================================================================;
  106.  
  107. GMS_Name:
  108.     dc.b    "games.library",0
  109.     even
  110. GMS_Base:
  111.     dc.l    0
  112.  
  113. AMT_PLANES =    7
  114.  
  115. ScreenStruct:
  116.     dc.l    "GSV1"
  117.     dc.l    0,0,0                    ;Screen_Mem1/2/3
  118.     dc.l    0                        ;Screen link.
  119.     dc.l    ScreenPalette            ;Address of screen palette.
  120.     dc.l    RasterList               ;Address of rasterlist.
  121.     dc.l    256                      ;Amt of colours in palette.
  122.     dc.w    256,320,320/8            ;Screen Height, Width, Width/8
  123.     dc.w    256,320,320/8            ;Pic Height, Width, Width/8
  124.     dc.w    AMT_PLANES               ;Amt_Planes
  125.     dc.w    0,0                      ;Top Of Screen, X/Y
  126.     dc.w    0                        ;Scroll buffer in pixels/8.
  127.     dc.w    0,0                      ;X/Y counters (for scrolling).
  128.     dc.l    NOBURST                  ;Special attributes.
  129.     dc.w    LORES|_24BITCOL          ;Screen mode.
  130.     dc.b    INTERLEAVED              ;Screen type
  131.     dc.b    0                        ;Screen Is Being Displayed?
  132.     dc.l    0,0                      ;Reserved area.
  133.     even
  134.  
  135. RasterList:
  136.     WAITLINE 000
  137.     FLOOD
  138.     RASTEND
  139.  
  140. ScreenPalette:
  141.     dc.l    $000000,$FFFFFF,$FAF5F2,$FAE8E7
  142.     dc.l    $EEDED5,$E8D4C8,$DDC0AF,$D7B5A2
  143.     dc.l    $D1AC96,$DCA491,$CBA38B,$C5997E
  144.     dc.l    $BD8E74,$B5846A,$AD7A5F,$A57056
  145.     dc.l    $9D674D,$955D44,$8C533B,$844B34
  146.     dc.l    $7C432D,$743B26,$6C3320,$642D1B
  147.     dc.l    $5C2616,$532010,$4A1D0C,$411A09
  148.     dc.l    $381606,$2F1204,$260F02,$1D0C00
  149.     dc.l    $AC783A,$A67139,$A06C39,$986638
  150.     dc.l    $995F36,$906037,$8C5C36,$945733
  151.     dc.l    $865735,$905030,$7E5133,$8D4B2E
  152.     dc.l    $764B31,$6E4630,$8A462D,$64412B
  153.     dc.l    $5D3D27,$593A24,$543822,$50351F
  154.     dc.l    $4B341D,$47301A,$592218,$402D17
  155.     dc.l    $382813,$3B2007,$302310,$2B200D
  156.     dc.l    $331100,$430907,$3C0504,$2E0202
  157.     dc.l    $B48038,$B7743D,$AE6350,$A85D4A
  158.     dc.l    $A35644,$9E503E,$994A39,$944534
  159.     dc.l    $9F4336,$8E3F30,$87412B,$87382A
  160.     dc.l    $823628,$803226,$792C21,$72251C
  161.     dc.l    $E1AB98,$DBA28C,$D79C89,$D29582
  162.     dc.l    $CD8D7A,$C88672,$C27E6B,$BD7764
  163.     dc.l    $B8705D,$B36A57,$BB5244,$AD4A3D
  164.     dc.l    $C8594A,$7F7444,$847D49,$67271E
  165.     dc.l    $6C2219,$651D15,$5E1711,$57130E
  166.     dc.l    $500F0B,$4A0C09,$350303,$270000
  167.     dc.l    $89874E,$8C8E53,$8C9358,$8E9D62
  168.     dc.l    $C6904A,$9AA467,$CD9E51,$AFAE6F
  169.     dc.l    $E3D765,$D5AE58,$BCAD78,$C1AC7C
  170.     dc.l    $CBAA82,$D5A588,$EAA09B,$ECA7A2
  171.     dc.l    $EDADA9,$EFB5B1,$F0BBB8,$F2C2BF
  172.     dc.l    $F4CBC8,$F5D1CF,$F7D9D7,$FDF7F7
  173.  
  174. PackedPicFile:
  175.     IFNE    LOCAL
  176.     dc.b    "GAMESLIB:Demos/"
  177.     ENDC
  178.     dc.b    "data/Yattering128.pak",0
  179.     even
  180.  
  181.